package com.zhang.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.zhang.entity.PcSetmealEntity;
import com.zhang.service.PcSetmealService;
import com.zhang.utils.PageUtils;
import com.zhang.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



/**
 * 
 *
 * @author Haziy
 * @email 1143878025@qq.com
 * @date 2023-03-10 15:04:39
 */
@RestController
@RequestMapping("pcSetmeal")
public class PcSetmealController {
    @Autowired
    private PcSetmealService pcSetmealService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        List<PcSetmealEntity> list = pcSetmealService.list();

        return R.ok().put("page", list);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		PcSetmealEntity pcSetmeal = pcSetmealService.getById(id);

        return R.ok().put("pcSetmeal", pcSetmeal);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody PcSetmealEntity pcSetmeal){
		pcSetmealService.save(pcSetmeal);

        return R.ok();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    public R update(@RequestBody PcSetmealEntity pcSetmeal){
		pcSetmealService.updateById(pcSetmeal);

        return R.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		pcSetmealService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
